package com.whpost.api.controller.sys;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.dev33.satoken.stp.StpUtil;
import com.whpost.api.controller.BaseController;
import com.whpost.api.utils.ApiUtils;
import com.whpost.service.entity.tools.ResultInfo;
import com.whpost.service.service.BaseServices;
import com.whpost.service.service.t.TCzyServices;
import com.whpost.service.service.t.TRoleServices;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/sys/czy")
public class TCzyController extends BaseController {

    @Autowired
    public TCzyController(TCzyServices tCzyServices) {
        super();
        setPerCode("czy");
        setBaseServices(tCzyServices);
    }

    private TCzyServices getServices() {
        return (TCzyServices) getBaseServices();
    }

    /**
     * 修改密码
     * @return
     */
    @SaCheckLogin
    @RequestMapping(value ="/xgmm")
    public ResultInfo xgmm(@RequestBody Map<String, Object> map){
        String loginId = ApiUtils.getLoginId();
        return getServices().xgmm(loginId,map);
    }

    /**
     * 重置密码
     * @return
     */
    @SaCheckPermission(value = {"czy:add", "czy:update"}, mode = SaMode.OR)
    @RequestMapping(value ="/czmm")
    public ResultInfo czmm(@RequestBody Map<String, Object> map){
        String loginId = ApiUtils.getLoginId();
        return getServices().czmm(loginId,map);
    }
}
